# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/12 22:24
# @Author   : Robot-Zsj
"""
description:

i:
1+5*7/8

o:
43/8
"""
s = input()

oper_num = []

oper_sign = []


class Fractions:
    def __init__(self, fa, ch):
        self.fa = fa  # 分母
        self.ch = ch  # 分子


def getMaxCommonDivisor(x, y):
    while y != 0:
        tmp = y
        y = x % y
        x = tmp
    return x


def calc():
    b = oper_num.pop()
    a = oper_num.pop()

    op = oper_sign.pop()

    result = Fractions(None, None)
    # a =1/2 b = 1/3 a+b = 1*3/2*3 + 1*2/3*2
    if op == '+':
        result.fa = a.fa * b.fa
        result.ch = a.ch * b.fa + b.ch * a.fa
    elif op == '-':
        result.fa = a.fa * b.fa
        result.ch = a.ch * b.fa - b.ch * a.fa
    elif op == '*':
        result.fa = a.fa * b.fa
        result.ch = a.ch * b.ch
    elif op == '/':
        result.fa = a.fa * b.ch
        result.ch = a.ch * b.fa

    oper_num.append(result)


def getResult():
    priority = {
        '+': 1,
        '-': 1,
        '*': 2,
        '/': 2
    }

    numStr = []

    i = 0

    while i < len(s):
        c = s[i]

        if '9' >= c >= '0':
            while '9' >= c >= '0':
                numStr.append(c)
                if i + 1 >= len(s):
                    break
                i += 1
                c = s[i]

            oper_num.append(Fractions(1, int("".join(numStr))))
            numStr.clear()

        if c == '+' or c == '-' or c == '*' or c == '/':
            while len(oper_sign) > 0 and oper_sign[-1] != '(' \
                    and priority[c] <= priority[oper_sign[-1]]:
                calc()
            oper_sign.append(c)
        elif c == ')':
            while oper_sign[-1] != '(':
                calc()

            oper_sign.pop()
        elif c == '(':
            oper_sign.append(c)
        i += 1

    while len(oper_num) > 1:
        calc()

    result = oper_num.pop()

    if result.fa == 0:
        return "ERROR"

    k = getMaxCommonDivisor(result.fa, result.ch)

    result.fa //= k
    result.ch //= k

    sign = "-" if result.fa * result.ch < 0 else ""

    fa = abs(result.fa)
    ch = abs(result.ch)

    if fa == 1:
        return f"{sign}{ch}"
    else:
        return f"{sign}{ch}/{fa}"


print(getResult())
